log using "$Rep_smokelabor/2_analysis/output_logs/table2.log", replace 
	
	use "$Rep_smokelabor/1_build/regdata/county_quarter.dta", clear 
	local tbl_settings_log format(%6.3f) parentheses(stderr) asterisk()
	local tbl_settings_pmil format(%6.1f) parentheses(stderr) asterisk()
	local append replace
	local c = 1
	
	foreach var in cen2010_fracurb acs0716_pov100 acs0716_p50homeval acs0716_fracblack avg_pm25 {
		reghdfe d_pc_qwi_payroll c.hms_deep##c.up50_`var' [aw=seer_pop], a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
		summ pc_qwi_payroll [aw=seer_pop] if e(sample)
		local ymean=`r(mean)'
		regsave using "$Rep_smokelabor/2_analysis/output_tables/table2.dta", addlabel(outcome_mean, "`ymean'") table(col`c', `tbl_settings_log') `append'
		local append append
		local c = `c'+1
	}
	reghdfe d_pc_qwi_payroll c.hms_deep##c.up50_* [aw=seer_pop], a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/table2.dta", addlabel(outcome_mean, "`ymean'") table(col6, `tbl_settings_log') `append'
	local append append
	
	preserve 
	
		use "$Rep_smokelabor/2_analysis/output_tables/table2.dta", clear
		drop if var == "r2"
		drop if var == "_id"
		drop if strpos(var, "_cons_") > 0
		replace var="observations" if var=="N"
		drop if _n<=2
		drop if inrange(_n,3,12)
		
		ingap 3
		ingap 6
		ingap 9
		ingap 12
		ingap 15
		ingap 18
		list , sep(0)
		saveold "$Rep_smokelabor/2_analysis/output_tables/table2.dta", replace
	restore 

log close
